<?php get_header() ?>
	
	<div id="container">
		<div id="content">

<?php $options=get_option('dkret3'); if ( have_posts() ) { the_post(); rewind_posts(); } ?>
<?php if ( in_category( $options['gallery_cat_id'] ) ) { ?>
<?php query_posts('cat='. ($options['gallery_cat_id']) .''); ?>
<?php while (have_posts()) : the_post(); ?>

			<div id="post-<?php the_ID(); ?>" class="<?php sandbox_post_class(); ?>">

				<div class="entry-gallery">
					<div class="entry-gallery-image">
						<a href="<?php permalink_link() ?>"><?php $hilite = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_type = 'attachment' LIMIT 1" ); echo wp_get_attachment_image( $hilite, 'thumbnail' ); ?></a>
						<p><?php printf(__('This album contains <strong>%s</strong> items.', 'dkret'), $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_type = 'attachment'" ) ) ?></p>
					</div><!-- .entry-gallery-image -->
					<h2 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s', 'dkret'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title(); ?></a></h2>

					<div class="entry-gallery-description">
						<?php the_excerpt(''); ?>
					</div><!-- .entry-gallery.description -->

<?php edit_post_link(__('Edit', 'dkret'), "\t\t\t\t\t<span class=\"edit-link\">", "</span>\n"); ?>					

				</div><!-- .entry-gallery -->

			</div><!-- #post- -->

<?php endwhile; ?>

			<div id="nav-below" class="navigation">
				<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&laquo;</span> Older Galleries', 'dkret')) ?></div>
				<div class="nav-next"><?php previous_posts_link(__('Newer Galleries <span class="meta-nav">&raquo;</span>', 'dkret')) ?></div>
			</div>

<?php } else { // If it's a regular post or a permalink page ?>

			<h2 class="page-title"><?php _e('Category Archives:', 'dkret') ?> <span><?php echo single_cat_title(); ?></span></h2>
			<div class="archive-meta"><?php if ( !(''== category_description()) ) : echo apply_filters('archive_meta', category_description()); endif; ?></div>

<?php while (have_posts()) : the_post(); ?>

			<div id="post-<?php the_ID(); ?>" class="<?php sandbox_post_class(); ?>">
				<h3 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf(__('Permalink to %s', 'dkret'), wp_specialchars(get_the_title(), 1)) ?>" rel="bookmark"><?php the_title() ?></a></h3>
				<div class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO'); ?>"><?php unset($previousday); printf(__('%1$s &#8211; %2$s', 'dkret'), the_date('', '', '', false), get_the_time()) ?></abbr></div>
				<div class="entry-content">
<?php 
$options=get_option('dkret3');
if($options['summary'] == 1 )
	the_excerpt(''.__('Read More <span class="meta-nav">&raquo;</span>', 'dkret').'');
else
	the_content(''.__('Read More <span class="meta-nav">&raquo;</span>', 'dkret').'');
?>

				</div>
				<div class="entry-meta">
					<span class="author vcard"><?php printf(__('By %s', 'dkret'), '<a class="url fn n" href="'.get_author_link(false, $authordata->ID, $authordata->user_nicename).'" title="' . sprintf(__('View all posts by %s', 'dkret'), $authordata->display_name) . '">'.get_the_author().'</a>') ?></span>
					<span class="meta-sep">|</span>
<?php if ( $cats_meow = sandbox_cats_meow(', ') ) : /* Returns categories other than the one queried */ ?>
					<span class="cat-links"><?php printf(__('Also posted in %s', 'dkret'), $cats_meow) ?></span>
					<span class="meta-sep">|</span>
<?php endif ?>
<?php the_tags(__('<span class="tag-links">Tagged ', 'dkret'), ", ", "</span>\n\t\t\t\t\t<span class=\"meta-sep\">|</span>\n") ?>
					<span class="comments-link"><?php comments_popup_link(__('Comments (0)','dkret'), __('Comments (1)','dkret'), __('Comments (%)','dkret'),'', __('Comments off','dkret') ); ?></span>
				</div><!-- .entry-meta -->
<?php edit_post_link(__('Edit', 'dkret'), "\t\t\t\t<span class=\"edit-link\">", "</span>\n"); ?>
			</div><!-- .post -->

<?php endwhile; ?>

			<div id="nav-below" class="navigation">
				<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&laquo;</span> Older posts', 'dkret')) ?></div>
				<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&raquo;</span>', 'dkret')) ?></div>
			</div>
<?php } ?>

		</div><!-- #content -->
	</div><!-- #container -->

<?php get_sidebar() ?>
<?php get_footer() ?>